#include "mainwindow.h"
#include "ui_mainwindow.h"


#include "device/HandleHelper.h"

using namespace std;
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_stop_clicked(bool checked)
{
    if(checked){

    }
    try{
        int ret = HandleHelper::GetInstance()->stopListen();
        cout << ret <<endl;
    }catch( T_HANDLER_E &e){
        cout <<"-->" << getHandlerErrorString(e) <<endl;
    }
}

void MainWindow::on_pushButton_clicked(bool checked)
{
    try{
        int ret = HandleHelper::GetInstance()->startListen();
        cout << ret <<endl;
    }catch(const T_HANDLER_E &e){
        cout <<"-->" << getHandlerErrorString(e) << int(e)<<endl;
    }
}
